using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace Yunwei.Domain.Models.Mapping
{
    public class StaffMap : EntityTypeConfiguration<Staff>
    {
        public StaffMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Name)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Avatar)
                .IsRequired()
                .HasMaxLength(200);

            this.Property(t => t.Description)
                .IsRequired();

            this.Property(t => t.Salary)
                .IsRequired();

            this.Property(t => t.Job)
                .IsRequired();

            // Table & Column Mappings
            this.ToTable("Staff");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Name).HasColumnName("Name");
            this.Property(t => t.Avatar).HasColumnName("Avatar");
            this.Property(t => t.Birthday).HasColumnName("Birthday");
            this.Property(t => t.Sex).HasColumnName("Sex");
            this.Property(t => t.Description).HasColumnName("Description");
            this.Property(t => t.Salary).HasColumnName("Salary");
            this.Property(t => t.Cuisine).HasColumnName("Cuisine");
            this.Property(t => t.Job).HasColumnName("Job");
            this.Property(t => t.Restaurant_Id).HasColumnName("Restaurant_Id");
            this.Property(t => t.Brief).HasColumnName("Brief");
        }
    }
}
